 @include "find.awk"
 @include "lib.awk"
 @include "nbins.awk"
 @include "dwrite.awk"

 function _finded(  name,lo,hi,goals,d,w,has,at,row,active) {
   readbins(3,"weathern",name,lo,hi,goals,d,w,has,at)
   dwrite(d,name,w)
   for(row in d) active[row]
   finded1(d,at,name,w,active,"windy=FALSE")
   finded1(d,at,name,w,active,"windy=FALSE      outlook=sunny")
   finded1(d,at,name,w,active,"windy=FALSE,TRUE outlook=sunny,rainy")
   finded1(d,at,name,w,active,"windy=FALSE      outlook=sunny,rainy Humid=3")
 }
 function finded1(d,at,name,w,active,str,   query,rows,row) {
   query(str,name,query)
   find(query,rows,at,active)
   print "\n~~~~ | " str "| = " length(rows) " |~~~~~~~~~~~~~~~~~~~~~~~~"
   for(row in rows)
     print rows[row]["val"] " = " rwrite(rows[row]["id"],d,w)
  }

# ~~~~ | windy=FALSE| = 8 |~~~~~~~~~~~~~~~~~~~~~~~~
# 1 = (FALSE),(114),(sunny),(1),(1)
# 1 = (FALSE),(105),(rainy),(2),(2)
# 1 = (FALSE),(101),(overcast),(3),(1)
# 1 = (FALSE),(10),(sunny),(3),(2)
# 1 = (FALSE),(100),(overcast),(3),(3)
# 1 = (FALSE),(110),(rainy),(1),(3)
# 1 = (FALSE),(90),(rainy),(1),(2)
# 1 = (FALSE),(20),(sunny),(2),(3)

# ~~~~ | windy=FALSE      outlook=sunny| = 3 |~~~~~~~~~~~~~~~~~~~~~~~~
# 2 = (FALSE),(20),(sunny),(2),(3)
# 2 = (FALSE),(114),(sunny),(1),(1)
# 2 = (FALSE),(10),(sunny),(3),(2)

# ~~~~ | windy=FALSE,TRUE outlook=sunny,rainy| = 10 |~~~~~~~~~~~~~~~~~~~~~~~~
# 2 = (TRUE),(116),(sunny),(2),(1)
# 2 = (FALSE),(10),(sunny),(3),(2)
# 2 = (TRUE),(15),(rainy),(2),(3)
# 2 = (TRUE),(12),(sunny),(3),(3)
# 2 = (FALSE),(110),(rainy),(1),(3)
# 2 = (FALSE),(90),(rainy),(1),(2)
# 2 = (TRUE),(15),(rainy),(1),(1)
# 2 = (FALSE),(20),(sunny),(2),(3)
# 2 = (FALSE),(114),(sunny),(1),(1)
# 2 = (FALSE),(105),(rainy),(2),(2)

# ~~~~ | windy=FALSE      outlook=sunny,rainy Humid=3| = 2 |~~~~~~~~~~~~~~~~~~~~~~~~
# 3 = (FALSE),(110),(rainy),(1),(3)
# 3 = (FALSE),(20),(sunny),(2),(3)
